package com.coscon.service.impl;

import com.coscon.model.ProcessInformations;
import com.coscon.service.ProcessService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;

@Slf4j
@Service
public class ProcessServiceImpl implements ProcessService {


    @Override
    public List<ProcessInformations> getProcessInformations() throws IOException {
        List<ProcessInformations> list = ProcessInformations.buildProcessInformations();
        return list;
    }

    @Override
    public boolean killByPid(String pid) {
        boolean flag = false;
        if(StringUtils.isBlank(pid)){
            return flag;
        }
        int pidInt = NumberUtils.toInt(pid,-1);
        if(pidInt<=0){
            return flag;
        }


        return flag;
    }


}
